<template>
  <h2>路由测试页面</h2>
  <div>{{ count }}</div>
  <button @click="goto">这是一个按钮</button>
  <h2>pinia测试部分{{ useStore.test }}</h2>
  <h2>用户：{{ userStore.userInfo.username }}</h2>
  <i class="fa fa-user"></i>
  <i class="fa fa-lightbulb-o"></i>
</template>

<script>
  import { useTestStore } from "@/store/test.js";
  import { useUserStore } from "@/store/user.js";
  import { defineComponent } from "vue";
  export default defineComponent({
    setup() {
      const useStore = useTestStore();
      const userStore = useUserStore();
      console.log(useStore.test);
      return {
        useStore,
        userStore,
      };
    },
    data() {
      return {
        count: 0,
      };
    },
    methods: {
      add() {
        this.count++;
        console.log(this);
      },
      goto() {
        // 编程式导航
        this.$router.push({ path: "/home" });
      },
    },
  });
</script>

<style></style>
